import pygame.sprite


class Bullet(pygame.sprite.Sprite):
    def __init__(self,r_go):
        super(Bullet, self).__init__()

        self.pingmu = r_go.pingmu
        self.shiezhi = r_go.shezhi
        self.color = self.shiezhi.bullet_color

        self.rect = pygame.Rect(0,0,self.shiezhi.bullet_width,self.shiezhi.bullet_height)
        self.rect.midtop = r_go.huojian.rect.center

        self.y = float(self.rect.y)
        self.x = float(self.rect.x)
    def update(self):
        # self.y -= self.shiezhi.bullet_spend
        # self.rect.y = self.y
        self.y -= self.shiezhi.bullet_spend
        self.rect.y = self.y


    def draw_bullet(self):
        pygame.draw.rect(self.pingmu,self.color,self.rect)